<style include="diagnostics-shared">
  #additionalMessage {
    @apply --diagnostics-routine-additional-message-font;
  }

  .button-container {
    @apply --diagnostics-button-font;
    padding: 8px 0 4px;
  }

  .learn-more-button {
    @apply --diagnostics-button-font;
    border-radius: 4px;
    height: 32px;
    margin-top: 12px;
    padding: 8px 16px;
  }

  #messageIcon {
    --iron-icon-height: 20px;
    --iron-icon-width: 20px;
    fill: var(--cros-icon-color-secondary);
    margin-inline-end: 8px;
  }

  .result-list {
    margin: 20px 0;
  }

  .routine-container {
    display: flex;
    justify-content: space-between;
  }

  .routine-section-container {
    display: flex;
    flex-direction: column;
  }

  .routine-status-container {
    display: flex;
    flex-direction: column;
  }

  #testStatusBadge {
    margin-bottom: 4px;
  }

  #testStatusText {
    @apply --diagnostics-test-status-text-font;
    padding-inline-start: 6px;
  }

  #toggleReportButton {
    margin-right: 8px;
  }

  :host([hide-routine-status]) .container-spacing {
    padding-inline: 20px;
  }

  :host(:not([hide-routine-status])) .container-spacing {
    margin-bottom: 16px;
    margin-top: 12px;
    padding-inline: 20px;
  }
</style>
<div class="routine-section-container container-spacing"
    hidden$="[[hideRoutineSection(routines.*)]]">
  <div id="routineSection" class="routine-container">
    <div class="routine-status-container" hidden$="[[hideRoutineStatus]]">
      <text-badge id="testStatusBadge" badge-type="[[badgeType_]]"
          hidden="[[isStatusHidden_(executionStatus_)]]"
          value="[[badgeText_]]">
      </text-badge>
      <span id="testStatusText"
          hidden$="[[isStatusHidden_(executionStatus_)]]">
        [[statusText_]]
        <span id="learnMoreText" class="link-text"
            hidden$="[[isLearnMoreHidden_(executionStatus_)]]"
            on-click="onLearnMoreClicked_">
          [[i18n('learnMoreShort')]]
        </span>
      </span>
    </div>
    <div class="button-container" hidden$="[[hideRoutineStatus]]">
        <iron-icon id="messageIcon" icon="diagnostics:info"
            hidden$="[[isAdditionalMessageHidden_(additionalMessage)]]">
        </iron-icon>
        <paper-tooltip for="messageIcon" aria-hidden="true" id="additionalMessage">
          [[additionalMessage]]
        </paper-tooltip>
      <cr-button id="toggleReportButton" on-click="onToggleReportClicked_"
          hidden="[[isResultButtonHidden_(executionStatus_, routines.*)]]">
        [[getReportToggleButtonText_(opened)]]
      </cr-button>
      <cr-button id="runTestsButton"
          hidden$="[[isRunTestsButtonHidden_(testSuiteStatus,
              executionStatus_)]]"
          on-click="runTests"
          disabled="[[isRunTestsButtonDisabled_(testSuiteStatus,
                                                additionalMessage)]]">
        [[runTestsButtonText]]
      </cr-button>
      <cr-button id="stopTestsButton"
          hidden$="[[isStopTestsButtonHidden_(executionStatus_)]]"
          on-click="stopTests">
        [[i18n('stopTestButtonText')]]
      </cr-button>
    </div>
  </div>
  <iron-collapse id="collapse" opened="{{opened}}">
    <div class="result-list">
      <routine-result-list id="resultList"
          hide-vertical-lines="[[hideVerticalLines]]"
          using-routine-groups="[[usingRoutineGroups]]">
      </routine-result-list>
    </div>
    <cr-button id="learnMoreButton" class="learn-more-button"
        on-click="onLearnMoreClicked_"
        hidden$="[[isLearnMoreButtonHidden_(isLoggedIn_, hideRoutineStatus)]]">
      [[i18n('learnMore')]]
    </cr-button>
  </iron-collapse>
</div>
